import { defineStore } from 'pinia'
import { ref } from 'vue'
export const useShopStore = defineStore('shopStore', () => {
  const shopInfo = ref({
		name: "", //店铺名称
		contacts: "", //联系人
		mobile: "", //联系人电话
		help_mobile: "", //客服电话
		logo: "", //logo
		head_imgs: "", //商家广告图
		detail_address: "", //店铺地址
		longitude: "", //经纬度
		latitude: "", //经纬度
		describe_text: "", //描述
		intro: "", //简介
		username: '',
		password: '',
		comment_score: '', // 商家评分
	})
	const checkedKeyWord = ref([])
	const SETSHOPINFO = (val) => {
		shopInfo.value = val
	}
	const SETKEYWORD = (arr) => {
		checkedKeyWord.value = arr
	}
	return {
		shopInfo,
		SETSHOPINFO,
		checkedKeyWord,
		SETKEYWORD
	}
}, {
  // 数据持久化
	persist: {
		storage: {
			getItem: (key) => {
			  return uni.getStorageSync(key)
			},
			setItem: (key, value) => {
			  return uni.setStorageSync(key, value)
			},
		}
	}
})
